#ifndef _MT5_SCORING_H_
#define _MT5_SCORING_H_

#include "mat_logicboard.h"
#include "mat_ui_combo.h"
#include "mat_score.h"


#include <vector>
#include <set>

namespace ui
{
	class UIProgress;
};

struct MATGem;

class MATScoring
{
public:

	static MATScoring&								Instance();
	
	
	void											AddMatched(	const std::vector<MATGem*>& List,
																const std::vector<int>&	XList,
																const std::vector<int>&	YList,
																int MoveToX,
																int MoveToY,
																int MoveFromX,
																int MoveFromY
																);

	void											ClearGem(int Y, int X);

	void											ResetFromCombo();
	void											Render(float Scale);
	void											Tick(float dt);
	void											NewGame();
	int												GetMatchCount() const { return m_MatchCount; };
	int												GetScoreValue() { return m_Score.GetValue(); };	
	int												CalculateBonus(int Combo, bool SameColor);
	float											GetComboShowingTime() const { return m_UICombo.GetShowingTime(); };

protected:

	MATScoring();
	int												CalculateScore(int CountOfMatch);

	int												m_CurrentCombo;
	int												m_SameColorCombo;
	std::set<int>									m_PreviousMatchedGems;

	MATUICombo										m_UICombo;
	//MATUICombo										m_UIComboSameColor;

	MATScore										m_Score;
	int												m_MatchCount;	
	ui::UIProgress*									m_pUIProgressScore;
	bool											m_IsStarGot[3];
	ui::UIWidget*									m_pUIStars[3];
	float											m_NextPeerScoreReportDelay;

};

#endif